class Solution(object):
    def validMountainArray(self, arr):
        """
        :type arr: List[int]
        :rtype: bool
        """
        state = 0
        for i in range(1, len(arr)):
            if arr[i] == arr[i - 1]:
                return False
            if arr[i] > arr[i - 1]:
                if state == 2:
                    return False
                state = 1
            if arr[i] < arr[i - 1]:
                if state == 0:
                    return False
                if state == 1:
                    state = 2
        return state == 2
